package com.allen.controller;

import com.allen.bean.Student;
import com.allen.service.Operation;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/list")
public class Lists extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<Student> students = new Operation().getAll();
        req.setAttribute("students", students);
        req.getRequestDispatcher("/list.jsp").forward(req, resp);
    }
}
